#include<bits/stdc++.h>
using namespace std;

/**
 * @file A static linked list 
 * is a linked list in an array that can be 
 * accessed through an array subscript (cursor). 
 * Its memory space is continuous.
 */

#define MAXSIZE 100
typedef struct {
    int data;
    int next;
}stalist[MAXSIZE];

 /**
 * @brief When we define an array MAXSIZE 100,
 * the range of the subscript is from [0,99],
 * so that's why in function the 'for' loop 
 * range is from [0,MAXSIZE-1).Because of 
 * the last subscript (L[MAXSIZE-1]), we 
 * have to handle it separately.
 */

void init_list(stalist &L){
    for(int i=0;i<MAXSIZE-1;i++){
        L[i].next=i+1;
    }
    L[MAXSIZE-1].next=-1;//<-!!!
}

bool forward_create(stalist &L){
   init_list(L);
   int first;
   first=0;
   int r=first;
   int x;
   cin>>x;
   while(x!=-1&&first!=-1){
    L[r].data=x;
    int s=L[first].next;
    if(s!=-1){
        L[r].next=s;
        r=s;
        first=L[s].next;
    }
    else{
        L[r].next=-1;
    }

    cin>>x;

   }
   if(x==-1){

    return true;

   }
   else{

    return false;

   }

}
void print_list(stalist L){
    int first=0;
    int current=first;
    while(current!=-1){
        cout<<L[current].data<<endl;
        current=L[current].next;
    }
//main and test
}
int main(){
    stalist L;
    forward_create(L);
    print_list(L);
    
return 0;
}